using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

using TRead = System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<string, string>>;

namespace JumpNFight.Simulation
{
    /// <summary>
    /// This class will be instantiated by the XNA Framework Content
    /// Pipeline to read the specified data type from binary .xnb format.
    /// 
    /// Unlike the other Content Pipeline support classes, this should
    /// be a part of your main game project, and not the Content Pipeline
    /// Extension Library project.
    /// </summary>
    public class StringStringPairListReader : ContentTypeReader<TRead>
    {
        protected override TRead Read(ContentReader input, TRead existingInstance)
        {
            int count = input.ReadInt32();
            TRead list = new TRead(count);
            for (int i = 0; i < count; i++)
                list.Add(new KeyValuePair<string, string>(input.ReadString(), input.ReadString()));

            return list;
        }
    }
}
